<template>
    <div class="my-ecg" ref="my-ecg"></div>
</template>

<script>
import ECG from '@/utils/ecg'
export default {
    props: {
        dataList: Array
    },
    data () {
        return {
            drawEcgTimer: null
        }
    },
    mounted () {
        var ecg = new ECG(this.$refs['my-ecg'])
        ecg.drawGird(25)
        ecg.setData(this.dataList)
        ecg.draw()
        this.drawEcgTimer = setInterval(() => {
            ecg.setData(this.dataList)
        }, 18 * 1000)
    },
    beforeDestroy () {
        clearInterval(this.drawEcgTimer)
    }
}
</script>

<style scoped>
.my-ecg{
    width: 100%;
    height: 100%;
}
</style>